/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.persistencia.domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.Size;

/**
 *
 * @author kenny
 */
@Entity
@Table(name = "dictadoxsalon")
@NamedQueries({
    @NamedQuery(name = "Dictadoxsalon.findAll", query = "SELECT d FROM Dictadoxsalon d"),
    @NamedQuery(name = "Dictadoxsalon.findByNDctId", query = "SELECT d FROM Dictadoxsalon d WHERE d.dictadoxsalonPK.nDctId = :nDctId"),
    @NamedQuery(name = "Dictadoxsalon.findBySlnId", query = "SELECT d FROM Dictadoxsalon d WHERE d.dictadoxsalonPK.slnId = :slnId"),
    @NamedQuery(name = "Dictadoxsalon.findByVEstado", query = "SELECT d FROM Dictadoxsalon d WHERE d.vEstado = :vEstado")})
public class Dictadoxsalon implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DictadoxsalonPK dictadoxsalonPK;
    @Size(max = 1)
    @Column(name = "vEstado")
    private String vEstado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "dictadoxsalon")
    private List<Periodoxsalon> periodoxsalonList;
    @JoinColumn(name = "SlnId", referencedColumnName = "nSlnId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Salon salon;
    @JoinColumn(name = "nDctId", referencedColumnName = "nDctId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Dictado dictado;

    public Dictadoxsalon() {
    }

    public Dictadoxsalon(DictadoxsalonPK dictadoxsalonPK) {
        this.dictadoxsalonPK = dictadoxsalonPK;
    }

    public Dictadoxsalon(int nDctId, int slnId) {
        this.dictadoxsalonPK = new DictadoxsalonPK(nDctId, slnId);
    }

    public DictadoxsalonPK getDictadoxsalonPK() {
        return dictadoxsalonPK;
    }

    public void setDictadoxsalonPK(DictadoxsalonPK dictadoxsalonPK) {
        this.dictadoxsalonPK = dictadoxsalonPK;
    }

    public String getVEstado() {
        return vEstado;
    }

    public void setVEstado(String vEstado) {
        this.vEstado = vEstado;
    }

    public List<Periodoxsalon> getPeriodoxsalonList() {
        return periodoxsalonList;
    }

    public void setPeriodoxsalonList(List<Periodoxsalon> periodoxsalonList) {
        this.periodoxsalonList = periodoxsalonList;
    }

    public Salon getSalon() {
        return salon;
    }

    public void setSalon(Salon salon) {
        this.salon = salon;
    }

    public Dictado getDictado() {
        return dictado;
    }

    public void setDictado(Dictado dictado) {
        this.dictado = dictado;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (dictadoxsalonPK != null ? dictadoxsalonPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Dictadoxsalon)) {
            return false;
        }
        Dictadoxsalon other = (Dictadoxsalon) object;
        if ((this.dictadoxsalonPK == null && other.dictadoxsalonPK != null) || (this.dictadoxsalonPK != null && !this.dictadoxsalonPK.equals(other.dictadoxsalonPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.persistencia.domain.Dictadoxsalon[ dictadoxsalonPK=" + dictadoxsalonPK + " ]";
    }
    
}
